package edu.ucuenca.tc.listenandtouch;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class AdaptadorTrasporteModo1 extends BaseAdapter{
	
	private Context mContext;
    
	private Integer[] mThumbIds = {
            R.drawable.ambulancia, R.drawable.avion, 
            R.drawable.barco, R.drawable.bomberos, 
            R.drawable.carro, R.drawable.helicoptero, 
            R.drawable.moto, R.drawable.policia, 
            R.drawable.tren, 
    };
	
	public AdaptadorTrasporteModo1(Context c){
		mContext=c;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mThumbIds.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(mThumbIds[position]);
        return imageView;
	}

}
